package com.xiaoma.myaudience.biz.model;

import android.content.ContentValues;
import android.database.Cursor;

import com.xiaoma.myaudience.util.model.BaseColumnInfo;


public class UserAccount extends BaseColumnInfo{
	/**登陆账号*/
	public final static String USERNAME = "username";
	/**登陆密码*/
	public final static String PASSWORD = "password";
	/**登陆产品ID*/
	public final static String PRODUCT = "product";
	/**登陆类型*/
	public final static String TYPE = "type";
	/**当前账号是否登陆 对应数据库1为登陆，0为未登陆*/
	public final static String ISLOGIN = "islogin";
	
	/**登陆账号*/
	public String mAccount;	
	/**登陆密码*/
	public String mPassword;	
	/**登陆产品ID*/
	public String mProduct = "t";	
	/**登陆类型*/
	public String mType = "1";	
	/**当前账号是否登陆 对应数据库1为登陆，0为未登陆*/
	public int mIsLogin = 0;
	
	
	@Override
	public void readFromCursor(Cursor cursor) {
		// TODO Auto-generated method stub
		super.readFromCursor(cursor);
		
		int index = -1;
        if ((index = cursor.getColumnIndex(USERNAME)) != -1) {
            mAccount = cursor.getString(index);
            index = -1;
        }
        if ((index = cursor.getColumnIndex(PASSWORD)) != -1) {
            mPassword = cursor.getString(index);
            index = -1;
        }
        if ((index = cursor.getColumnIndex(ISLOGIN)) != -1) {
        	mIsLogin = cursor.getInt(index);
            index = -1;
        }
	}
	
	@Override
	public ContentValues generateContentValues() {
		ContentValues values = new ContentValues();
		values.put(USERNAME, mAccount);
		values.put(PASSWORD, mPassword);
		values.put(ISLOGIN, mIsLogin);
		return values;
	}
	
}